'use strict';

var app = new Vue({
    el: '#app',
    data: {
        referrerID: '', //推荐人手机号
        //推荐人头像
        referInfo: {},
        //是否显示扫一扫、还是推荐人的盒子
        showScan: true,
    },
    mounted: function () {
        $('body').on('click','#meiqiakefu',function(){
            $('#MEIQIA-BTN').click();
        })
    },
    
    methods: {
        //清除手机号
        clearPhone: function clearPhone() {
            this.referrerID = '';
        },
        //输入提交
        onSubmit: function onSubmit() {
            var self = this;
            $.get('/mobile/index/bindrefer?do=refer&uid='+this.referrerID).then(function(res){
                if(res.ret==0) {
                    self.showScan = false;
                    self.referInfo = res.data;
                }
            })
        },
        //显示绑定ID按钮块
        showBindBtn: function showBindBtn() {
            this.showScan = true;
        },
        confirm: function () {
            $.ajax({
                type:'post',
                url:'/mobile/index/bindrefer?do=bind',
                data: {
                    uid:this.referInfo.uid,
                }
            }).then(function(res) {
                if(res.ret==1) {
                    showerror(res.msg);
                }else{
                    showsuccess(res.msg,res.url);
                }
            })
        }
    }
});